package com.onegroup.service.impl;

import com.onegroup.mapper.ExpertMapper;
import com.onegroup.pojo.Expert;
import com.onegroup.service.ExpertService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import javax.annotation.Resource;
import java.util.List;

/**
 * @Author 罗宇豪
 * @Date 2022/09/08 15:14
 * @Description
 * @History
 **/
@Service
@Transactional
public class ExpertServiceImpl implements ExpertService {

    @Autowired
    private ExpertMapper expertMapper;

    // 查找所有专家
    @Override
    public List<Expert> queryAllExperts() {
        return this.expertMapper.selectAllExperts();
    }

    // 依据条件模糊查找专家
    @Override
    public List<Expert> queryExpertByCondition(Expert expert) {
        return this.expertMapper.selectExpertByCondition(expert);
    }

    // 根据id删除专家
    @Override
    public void removeExpertByIds(Integer[] expIds) {
        // 删除专家
        this.expertMapper.deleteExpertByIds(expIds);
    }

    @Override
    public void addExpert(Expert expert) {
        // 添加专家
        this.expertMapper.insertExpert(expert);
    }

    public void modifyExpert(Expert expert) {
        //修改专家信息
        this.expertMapper.selectAllExperts();
    }
}
